<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="description" content="融合智慧 共创未来 冠军" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
     那微微的星火 是希望
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.png" />
  
  <link rel="stylesheet" href="/css/style.css">
  <script src="/js/pace.min.js"></script>

  

  

</head>

</html>

<body>
  <div id="app">
    <main class="content">
      
<section class="cover">
    
  <div class="cover-frame">
    <div class="bg-box">
      <img src="/images/cover1.jpg" alt="image frame" />
    </div>
    <div class="cover-inner text-center text-white">
      <h1><a href="/">那微微的星火 是希望</a></h1>
      <div id="subtitle-box">
        
        <span id="subtitle"></span>
        
      </div>
      <div>
        
      </div>
    </div>
  </div>
  <div class="cover-learn-more">
    <a href="javascript:void(0)" class="anchor"><i class="ri-arrow-down-line"></i></a>
  </div>
</section>



<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js"></script>

<div id="main">
  <section class="outer">
  <article class="articles">
    
    
    
    
    <article id="post-为满足前端要求，使用HandlerMethodReturnValueHandler包装响应，誓死不改代码风格" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2021/04/15/为满足前端要求，使用HandlerMethodReturnValueHandler包装响应，誓死不改代码风格/"
    >为满足前端要求，使用 HandlerMethodReturnValueHandler 包装响应，打死不改代码风格</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2021/04/15/为满足前端要求，使用HandlerMethodReturnValueHandler包装响应，誓死不改代码风格/" class="article-date">
  <time datetime="2021-04-15T05:47:31.000Z" itemprop="datePublished">2021-04-15</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Spring/">Spring</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h2><ul>
<li>前端一直不太认同http status(状态码)表达操作成功与否的方式，强烈要求所有接口都返回200，在响应体中增加code来表示操作是否成功。</li>
</ul>
      
      <a class="article-more-link" href="/2021/04/15/为满足前端要求，使用HandlerMethodReturnValueHandler包装响应，誓死不改代码风格/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SpringBoot/">SpringBoot</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/统一响应/">统一响应</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-DispatcherServlet中的两个设计模式（个人理解）" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/07/15/DispatcherServlet中的两个设计模式（个人理解）/"
    >DispatcherServlet中的两个设计模式（个人理解）</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/07/15/DispatcherServlet中的两个设计模式（个人理解）/" class="article-date">
  <time datetime="2020-07-15T01:14:52.000Z" itemprop="datePublished">2020-07-15</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>最近在看Spring Boot源码，对其中的DispatcherServlet产生兴趣，观察了请求到达后，该类如何运行的，以及它的涉及的设计模式，做了一下简单的分析。<br>
      
      <a class="article-more-link" href="/2020/07/15/DispatcherServlet中的两个设计模式（个人理解）/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Spring/">Spring</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/设计模式/">设计模式</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-微信小程序测试账号-不出现appid" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/05/08/微信小程序测试账号-不出现appid/"
    >微信小程序测试账号 不出现appid</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/05/08/微信小程序测试账号-不出现appid/" class="article-date">
  <time datetime="2020-05-08T02:01:46.000Z" itemprop="datePublished">2020-05-08</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="正确解决方法"><a href="#正确解决方法" class="headerlink" title="正确解决方法"></a>正确解决方法</h2><p>不废话，按照以下步骤操作</p>
<ol>
<li>登陆微信开发社区 <a href="https://developers.weixin.qq.com/" target="_blank" rel="noopener">https://developers.weixin.qq.com/</a></li>
<li>登陆微信小程序测试号 <a href="https://developers.weixin.qq.com/" target="_blank" rel="noopener">https://developers.weixin.qq.com/</a></li>
<li>出现appid</li>
</ol>

      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/appid/">appid</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/微信小程序/">微信小程序</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Flutter-使用Listener在点击切换状态" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/03/07/Flutter-使用Listener在点击切换状态/"
    >Flutter 使用Listener在点击切换状态</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/03/07/Flutter-使用Listener在点击切换状态/" class="article-date">
  <time datetime="2020-03-07T08:41:07.000Z" itemprop="datePublished">2020-03-07</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>通过使用Listener 在 StatefulWidget中实现点击切换状态,下面是实现效果<br><img src="/img/2020-01/flutter.gif" alt></p>
      
      <a class="article-more-link" href="/2020/03/07/Flutter-使用Listener在点击切换状态/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Flutter/">Flutter</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/前端/">前端</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-guava中Lists-partition方法分割List源码分析" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/20/guava中Lists-partition方法分割List源码分析/"
    >guava中Lists.partition方法分割List源码分析</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/20/guava中Lists-partition方法分割List源码分析/" class="article-date">
  <time datetime="2020-02-20T09:15:38.000Z" itemprop="datePublished">2020-02-20</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="主旨"><a href="#主旨" class="headerlink" title="主旨"></a>主旨</h2><p>&nbsp;&nbsp;&nbsp;&nbsp;在对List进行批量操作时，为了控制每次处理List的数据量，通常会将一个大的List进行分割，这时可以用到 com.google.guava 包中的 Lists.partition(List<t> list, int size) 方法。网上也有对这段代码分析的文章，看了几篇之后感觉没有说到重点，所以自己写一篇。</t></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;这段源码的重点在于Lists.partition方法返回的是Partition类，这是一个继承自java.util.List的私有类，该方法返回的实例list调用get等方法时的处理，实际是Partition类中覆写的代码来完成的。</p>
<h2 id="执行流程"><a href="#执行流程" class="headerlink" title="执行流程"></a>执行流程</h2>
      
      <a class="article-more-link" href="/2020/02/20/guava中Lists-partition方法分割List源码分析/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/源码分析/">源码分析</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-微信小程序自定义组件与页面值传递过程图解" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2019/08/01/微信小程序自定义组件与页面值传递过程图解/"
    >微信小程序自定义组件与页面值传递过程图解</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2019/08/01/微信小程序自定义组件与页面值传递过程图解/" class="article-date">
  <time datetime="2019-08-01T15:33:18.000Z" itemprop="datePublished">2019-08-01</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><ul>
<li>提取页面公共部分作为自定义组件，本文就组件与页面间的值传递过程用图片方式展示，仅是个人理解，可能存在偏差。</li>
</ul>
      
      <a class="article-more-link" href="/2019/08/01/微信小程序自定义组件与页面值传递过程图解/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/微信小程序/">微信小程序</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/组件/">组件</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-springboot-jpa-druid-动态切换数据源记录" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2019/07/10/springboot-jpa-druid-动态切换数据源记录/"
    >springboot jpa druid 动态切换数据源记录</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2019/07/10/springboot-jpa-druid-动态切换数据源记录/" class="article-date">
  <time datetime="2019-07-10T12:05:58.000Z" itemprop="datePublished">2019-07-10</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="场景"><a href="#场景" class="headerlink" title="场景"></a>场景</h2><ul>
<li>大型应用中的读写分离；</li>
<li>相同业务逻辑，但是对应多个数据库；
      
      <a class="article-more-link" href="/2019/07/10/springboot-jpa-druid-动态切换数据源记录/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/datasource/">datasource</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springboot/">springboot</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/动态切换数据源/">动态切换数据源</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-redis-session时，sessionId作为token，可靠实现" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2019/04/19/redis-session时，sessionId作为token，可靠实现/"
    >redis session时，sessionId作为token，可靠实现</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2019/04/19/redis-session时，sessionId作为token，可靠实现/" class="article-date">
  <time datetime="2019-04-19T04:06:01.000Z" itemprop="datePublished">2019-04-19</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="场景："><a href="#场景：" class="headerlink" title="场景："></a>场景：</h2><p>在一些不能使用session，或者session不能保持的情况，通常服务器端产生一个token字符串标识用户登录状态。当前端调用后端接口时，将此token作为参数加入到请求中，这样能够避免依赖浏览器与服务端会话状态。token身份验证可用于多域名间保持用户状态，后端负载均衡非ip hash策略等情况。<br>
      
      <a class="article-more-link" href="/2019/04/19/redis-session时，sessionId作为token，可靠实现/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/redis/">redis</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/session/">session</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/token/">token</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/适配器模式/">适配器模式</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-post请求响应405，两种解决办法" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2019/03/18/post请求响应405，两种解决办法/"
    >post请求响应405，两种解决办法</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2019/03/18/post请求响应405，两种解决办法/" class="article-date">
  <time datetime="2019-03-18T14:56:01.000Z" itemprop="datePublished">2019-03-18</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h2><ul>
<li><p>为什么会出现405呢，一般是因为在发送POST请求时，请求路径写错，比如后端接口地址是/api/abc/ 而发送请求时的路径为/api/abc 没有了最后的斜线。</p>
</li>
<li><p>这个问题一般通过后端做路径补全解决，如果要求前端每个都严格对上路径格式，那就太难为人了，增加无用工作量。</p>
</li>
</ul>
      
      <a class="article-more-link" href="/2019/03/18/post请求响应405，两种解决办法/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/405/">405</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Java/">Java</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Nginx/">Nginx</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Spring/">Spring</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-处理json参数的注解，更方便的获取请求参数" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2019/03/07/处理json参数的注解，更方便的获取请求参数/"
    >处理json参数的注解，更方便的获取请求参数</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2019/03/07/处理json参数的注解，更方便的获取请求参数/" class="article-date">
  <time datetime="2019-03-07T03:16:22.000Z" itemprop="datePublished">2019-03-07</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/技术/">技术</a>
  </div>

      
      
      
    </div>
    

    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="JSONParam需求描述"><a href="#JSONParam需求描述" class="headerlink" title="@JSONParam需求描述"></a>@JSONParam需求描述</h2><p>当请求的content-type为application/json时实现一下功能：</p>
<ol>
<li>对请求体中的参数做required判断</li>
<li>解析参数为指定类型</li>
<li>提供默认值</li>
</ol>
      
      <a class="article-more-link" href="/2019/03/07/处理json参数的注解，更方便的获取请求参数/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JSON/">JSON</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Java/">Java</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Spring/">Spring</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/注解开发/">注解开发</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
  </article>
  

  
  <nav class="page-nav">
    
    <span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/">下一页</a>
  </nav>
  
</section>
</div>

      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2015-2021
        AChampion
      </li>
      <li>
        
          Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="那微微的星火 是希望"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">目录</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>开玩笑的~不用打赏</p>
  <div class="reward-box">
    
    
  </div>
</div>
      <script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.justifiedGallery.min.js"></script>
<script src="/js/lazyload.min.js"></script>
<script src="/js/busuanzi-2.3.pure.min.js"></script>
<script src="/js/share.js"></script>

<script src="/fancybox/jquery.fancybox.min.js"></script>



<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['综合型创新是易实现 容易把握的','相信希望的力量','打不死你的，终将使你强大'],
    startDelay: 0,
    typeSpeed: 200,
    loop: true,
    backSpeed: 100,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script>
  var ayerConfig = {
    mathjax: false
  }
</script>

<script src="/js/ayer.js"></script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>




<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>